package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class CreateStatement {
	public static void main(String[] args) {
		try {
			// Step1: Loading Driver
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			System.out.println("Driver Loaded successfully.");

			// Step2: Establish Connection
			Connection con = DriverManager.getConnection("jdbc:odbc:myDSN",
					"scott", "tiger");
			System.out.println("Driver Connected successfully.");

			// Step3.1: Create Statement
			Statement stmt = con.createStatement();
			System.out.println("Statement Created successfully.");

			// Step3.2: Build SQL Query & execute
			stmt.execute("INSERT INTO myTable VALUES ( 1,'Raj', 25000 )");
			System.out.println("Record inserted successfully.");

			stmt.close();
			con.close();
		} catch (Exception e) {
			System.out.println(e.toString());
		}
	}
}
